<template>
	<div class="basic-setting">
		<div class="title">弹幕姬设置</div>
		<el-form label-position="top" :model="settingForm">
			<el-form-item label="弹幕姬">
				<el-switch
					v-model="settingForm.barrage"
					active-text="开启"
					inactive-text="关闭"
					@change="openBarrage"
				>
				</el-switch>
			</el-form-item>
			<el-form-item label="礼物掉落动画">
				<el-switch
					v-model="settingForm.giftDrop"
					active-text="开启"
					inactive-text="关闭"
				>
				</el-switch>
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
export default {
	data() {
		return {
			settingForm: {
				// 弹幕姬
				barrage: !!+localStorage.getItem("barrageState") || false,
				// 礼物掉落
				giftDrop: false,
			},
		};
	},
	methods: {
		openBarrage(val) {
			localStorage.setItem("barrageState", val ? 1 : 0);
			val
				? this.$electron.ipcRenderer.send("open-barrage")
				: this.$electron.ipcRenderer.send("close-barrage");
		},
	},
};
</script>

<style lang="scss"></style>
